// 购物车
import request from '@/utils/request'

// 此接口需要登录后才能操作，在请求拦截器中配置token
export const addCarts = (goodsId, goodsNum, goodsSkuId) => {
  return request.post('cart/add', {
    goodsId,
    goodsNum,
    goodsSkuId
  })
}

export const getCartTotal = () => {
  return request.get('cart/total')
}

// 查询购物车列表
export const getCartList = () => {
  return request.get('cart/list')
}

// 购物车更新商品
export const updateCartProd = (goodsId, goodsNum, goodsSkuId) => {
  return request.post('cart/update', {
    goodsId,
    goodsNum,
    goodsSkuId
  })
}

// 删除购物车商品
export const delCart = (cartIds) => {
  return request.post('cart/clear', { cartIds })
}

// 查询默认收货地址
export const defaultAddress = () => {
  return request.get('address/detail', {
    params: {
      addressId: '10012'
    }
  })
}
